<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>

</html>
<script>
    // 声明人的类
    class People {
        // 类的属性
        constructor(name, age) { // 构造器，实例化方法的时候触发
            this.name = name
            this.age = age
        }
        // 类的方法
        sport() {
            return this.name + '会运动'
        }
    }
    let p = new People('小明',18);
    console.log(p);
    console.log(p.sport());

    class Son extends People {
       constructor(num,name,age){
         super(name,age); // 位置一定在最上面
         this.num = num;
       }
    }

    let s = new Son(30,'小李',19);
    console.log(s);
</script>